package com.yykj.hospital.server.converter;

import com.yykj.hospital.client.dto.DoctorDTO;
import com.yykj.hospital.server.model.entity.HospitalDoctor;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

public class DoctorDTOConverter {
    public static DoctorDTO convert(HospitalDoctor doctor){
        DoctorDTO doctorDTO = new DoctorDTO();
        BeanUtils.copyProperties(doctor,doctorDTO);
        return doctorDTO;
    }

    public static List<DoctorDTO> convert(List<HospitalDoctor> list){
        return list.stream().map(DoctorDTOConverter::convert).collect(Collectors.toList());
    }
}
